//
//  RMMOderDeatilsTableViewCell.m
//  Romomo
//
//  Created by puman on 2016/10/24.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMOderDeatilsTableViewCell.h"

@implementation RMMOderDeatilsTableViewCell
{
    UILabel *_payTypeLabel;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 80, 44)];
        label.text = @"订单信息";
        label.font = kFont(13);
        label.textColor = COLORFROMCODE(0x4A4A4A, 1);
        [self.contentView addSubview:label];
        
        NSArray *array = @[@"订单号   :",@"预约人   :",@"服务地址:",@"下单时间:",@"服务时间:"];
        for (int i = 0; i < 5; i++) {
            UILabel *labelL = [[UILabel alloc] initWithFrame:CGRectMake(15, label.bottom + 25 * i, 60, 25)];
            labelL.textColor = COLORFROMCODE(0x9B9B9B, 1);
            labelL.text = array[i];
            labelL.font = kFont(13);
            [self.contentView addSubview:labelL];
            
            UILabel *labelR = [[UILabel alloc] initWithFrame:CGRectMake(labelL.right, labelL.top, kScreenWideth - labelL.right - 15, labelL.height)];
            labelR.textColor = COLORFROMCODE(0x303137, 1);
            labelR.font = kFont(13);
            labelR.numberOfLines = 0;
            labelR.tag = 1 + i;
            labelR.textAlignment = NSTextAlignmentRight;
            [self.contentView addSubview:labelR];

        }
        UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, label.bottom + 125, kScreenWideth - 30, 1)];
        lineLabel.backgroundColor = COLORFROMCODE(0xEEEEEE, 1);
        [self addSubview:lineLabel];
        
        UILabel *labelB = [[UILabel alloc] initWithFrame:CGRectMake(15, lineLabel.bottom, 80, 44)];
        labelB.text = @"支付方式:";
        labelB.font = kFont(13);
        labelB.textColor = COLORFROMCODE(0x4A4A4A, 1);
        [self.contentView addSubview:labelB];

        _payTypeLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelB.right, labelB.top, kScreenWideth - labelB.right - 15, 44)];
        _payTypeLabel.font = kFont(13);
        _payTypeLabel.textColor = COLORFROMCODE(0x53C7C6, 1);
        _payTypeLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_payTypeLabel];

    }
    return self;
}
- (void)setDic:(NSDictionary *)dic{
    if ([dic[@"ORDER_STATUS"] isEqualToNumber:@0]) {
        _payTypeLabel.text = @"待支付";
        _payTypeLabel.textColor = RGBA(228, 157, 56, 1);
    } else {
        _payTypeLabel.textColor = kBasicColor;
        NSString *payType = [NSString stringWithFormat:@"%@",dic[@"CASH_TYPE"]];
        if ([payType isEqualToString:@"5"]) {
            _payTypeLabel.text = @"会员卡支付";
        } else if ([payType isEqualToString:@"7"]) {
            _payTypeLabel.text = @"微信支付";
        } else if ([payType isEqualToString:@"8"]) {
            _payTypeLabel.text = @"支付宝支付";
        } else if ([payType isEqualToString:@"11"]) {
            _payTypeLabel.text = @"苹果pay支付";
        } else if ([payType isEqualToString:@"999"]) {
            _payTypeLabel.text = @"套餐支付";
        }
    }
    for (int i = 0; i < 5; i++) {
        UILabel *label = [self viewWithTag:1 + i];
        switch (i) {
            case 0:
                label.text = dic[@"ORDER_NO"];
                break;
            case 1:
                label.text = [NSString stringWithFormat:@"%@ %@ %@",dic[@"CUST_NAME"],dic[@"GENDER"],dic[@"CUST_MOBILE"]];
                break;
            case 2:
                label.text = [NSString stringWithFormat:@"%@%@",dic[@"REGION_NAME"],dic[@"DE_ADDRESS"]];
                break;
            case 3:
                label.text = dic[@"ORDER_TIME"];
                break;
            case 4:
                label.text = [NSString stringWithFormat:@"%@至%@",dic[@"SERVER_TIME"],dic[@"END_DATE"]];
                break;
    
            default:
                break;
        }
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
